home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / • Obsolete⁄Unsupported / ScriptX / Code Samples / autofind / source / adobject.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  1.7 KB  |  68 lines  |  [TEXT/ttxt]

  1. --<<<-
  2. -- Filename: 
  3. --     adobject.sx
  4.  
  5. -- Other Files Required:
  6. --     None
  7.  
  8. -- Purpose:  
  9. --     adobject.sx defines the AdDataObject class, which represents a classified ad.
  10.  
  11. -- Specialized Classes:  
  12. --     AdDataObject
  13.  
  14. -- Instructions to User: 
  15. --     The AdDataObject is a class which is simply a collection of data properties
  16. --     for cars for sale.
  17.  
  18. -- Author:
  19. --     Dionn Stewart
  20.  
  21. in module Autofinder
  22.  
  23. class AdDataObject ()
  24. instance variables
  25.     classification
  26.     name            -- string, the name of the object (currently same as model)
  27.     model            -- string, the name of the car
  28.     year                -- integer, the year of the car
  29.     price            -- integer, the asking price of the car
  30.     location            -- owner's location on map
  31.     adPic            -- a bitmap, the picture of the car for the ad
  32.     adText            -- a string, the text of the ad for the car
  33.     mapPresenter
  34.     adNotes            -- text object to hold notes
  35. end
  36.  
  37. method init self {class AdDataObject} #rest args #key data: (undefined) ->
  38. (
  39.     apply nextMethod self args
  40.     -- If data is passed in, fill in instance variables.
  41.     if (data <> undefined) then
  42.     (
  43.         self.adPic := data[9]
  44.         self.classification := data[2]
  45.         self.name := data[3]
  46.         self.model := data[3]
  47.         self.year := data[4]
  48.         self.price := data[5]
  49.         self.adText := data[6]
  50.         self.location := new Point x:data[7] y:data[8]
  51.         self.adNotes := new text string:""
  52.         makePurgeable self.adPic
  53.     )
  54.     -- No data, set the defaults.
  55.     else
  56.     (
  57.         -- Create a bitmap with black invisible color.
  58.         local ws := new bitmapsurface bbox:(new rect x2:200 y2:163)
  59.         erase ws blackbrush
  60.         local wbm := coerce ws Bitmap
  61.         wbm.invisiblecolor :=  blackcolor
  62.         self.adPic := wbm
  63.         self.adText := ""
  64.     )
  65.     return self
  66. )
  67. -->>>
  68. "Compiled adobject.sx"